[Chapter 14] 14.3 The RS-232 Serial Protocol
Author: Simson Garfinkel & Gene Spafford
Date: 1999-02-04T00:11:40Z

#

| Chapter 14 Telephone Security |

## 14.3 The RS-232 Serial Protocol

One of the most common serial interfaces is based on the RS-232 standard, which was developed primarily to allow individuals to use terminals with remote computer systems over a telephone line more easily.

The basic configuration of a terminal and a computer connected by two modems is shown in Figure 7.2.

#### Figure 14.2: A terminal and a computer connected by two modems

The computer and terminal are called data terminal equipment (DTE), while the modems are called data communication equipment (DCE). The standard RS-232 connector is a 25-pin D-shell type connector; only nine pins are used to connect the DTE and DCE sides together, as seen in Figure 14.3.

#### Figure 14.3: The standard 25-pin RS-232 connector

Of these nine pins, only transmit data (pin 2), receive data (pin 3), and signal ground (pin 7) are essential for directly wired communications. Five pins (2, 3, 7, 8, and 20) are needed for proper operation of modems. Frame ground (pin 1) was originally used to connect electrically the physical frame of the DCE and the frame of the DTE to reduce electrical hazards, although its use has been discontinued in the RS-232-C standard. Table 14.1 describes the use of each pin.

Table 14.1: .RS-232 Pin Assignments for a 25-Pin Connector
Pin | Code | Name | Description
--- | --- | --- | ---
1 | FG | Frame Ground | Chassis ground of equipment. (Note: this pin is historical; modern systems don't connect the electrical ground of different components together, because such a connection causes more problems than it solves.)
2 | TD | Transmit Data | Data transmitted from the computer or terminal to the modem.
3 | RD | Receive Data | Data transmitted from the modem to the computer.
4 | RTS | Request to Send | Tells the modem when it can transmit data. Sometimes the computer is busy and needs to have the modem wait before the next character is transmitted. Used for "hardware flow control."
5 | CTS | Clear to Send | Tells the computer when it's okay to transmit data. Sometimes the modem is busy and needs to have the computer wait before the next character is transmitted. Used for "hardware flow control."
6 | DSR | Data Set Ready | Tells the computer that the modem is turned on. The computer should not send the modem commands if this signal is not present.
7 | SG | Signal Ground | Reference point for all signal voltages.
8 | DCD | Data Carrier Detect | Tells the computer that the modem is connected by telephone with another modem. UNIX may use this signal to tell it when to display a`` login:``banner.
22 | RI | Ring Indicator | Tells the computer that the telephone is ringing.
20 | DTR | Data Terminal Ready | Tells the modem that the computer is turned on and ready to accept connections. The modem should not answer the telephone - and it should automatically hang up on an established conversation - if this signal is not present.

Because only eight pins of the 25-pin RS-232 connector are used, the computer industry has largely moved to smaller connectors that have fewer pins and cost less money to produce. Most PCs are equipped with a 9-pin RS-232 connector, which has pin assignments: listed in Table 14.2.

Table 14.2: .RS-232 Pin Assignments for 25- and 9-pin Connectors
Code | Name | 25-pin Connector Assignment | 9-pin Connector Assignment
--- | --- | --- | ---
TD | Transmit Data | 2 | 3
RD | Receive Data | 3 | 2
RTS | Request to Send | 4 | 7
CTS | Clear to Send | 5 | 8
DSR | Data Set Ready | 6 | 6
SG | Signal Ground | 7 | 5
DCD | Data Carrier Detect | 8 | 1
DTR | Data Terminal Ready | 20 | 4
RI | Ring indicator | 22 | 9

A number of nonstandard RS-232 connectors are also in use. The Apple Macintosh computer uses a circular 9-pin DIN connector, and there are several popular (and incompatible) systems for using standard modular telephone cords.

In general, you should be suspicious of any RS-232 system that claims to carry all eight signals between the data set and the data terminal without the full complement of wires.

### 14.3.1 Originate and Answer

Modern modems can both place and receive telephone calls. After a connection between two modems is established, information that each modem receives on the TD pin is translated into a series of tones that are sent down the telephone line. Likewise, each modem takes the tones that it receives through its telephone connection, passes them through a series of filters and detectors, and eventually translates them back into data that is transmitted on the RD pin.

To allow modems to transmit and receive information at the same time, different tones are used for each direction of data transfer. By convention, the modem that places the telephone call runs in originate mode and uses one set of tones, while the modem that receives the telephone call operates in answer mode and uses another set of tones.

High-speed modems have additional electronics inside them that perform data compression before the data is translated into tones. Some high-speed modems automatically reallocate their audio spectrum as the call progresses to maximize signal clarity and thus maximize data transfer speed. Others allocate a high-speed channel to the answering modem and a low-speed channel to the originating modem, with provisions for swapping channels should the need arise.

Further details on modem operation are available from any reasonably current book on data communications. Some are listed in Appendix D, Paper Sources.

14.2 Serial Interfaces |  | 14.4 Modems and Security